#!/bin/sh
#
# $FreeBSD$
#   $MCom: portstools/tinderbox/etc/rc.d/tinderd,v 1.7.2.3 2012/01/15 09:01:08 crees Exp $
#

# PROVIDE: tinderd
# REQUIRE: LOGIN mysql postgresql
# KEYWORD: shutdown

# Add the following line to /etc/rc.conf to enable `tinderd':
#
#tinderd_enable="YES"
#

. /etc/rc.subr

name="tinderd"
rcvar=tinderd_enable

# read settings, set default values
load_rc_config "${name}"
: ${tinderd_enable="NO"}
: ${tinderd_directory="/space/scripts"}
: ${tinderd_flags=""}
: ${tinderd_debug="NO"}
: ${tinderd_instances="1"}

# path to your executable, might be libexec, bin, sbin, ...
command="${tinderd_directory}/tinderd"

# needed when your daemon is a shell script
command_interpreter="/bin/sh"

# extra required arguments
if checkyesno tinderd_debug
then
    command_args=" &"
else
    command_args=">/dev/null 2>&1 &"
fi

start_cmd="${name}_start"

tinderd_start()
{
	for i in `jot - 1 ${tinderd_instances}`; do
		${command} ${tinderd_flags} >/dev/null 2>&1 &
	done
}

run_rc_command "$1"
